<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8" import="pojo.*,service.*,java.util.*,java.text.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>修改密码</title>
<script> 
function tiao(){
	location.top.href="../../website/memberzone.jsp";
	};
	setTimeout(tiao,1000);
	</script>
</head>
<body>
<%
request.setCharacterEncoding("UTF-8");

int id = (Integer)session.getAttribute("id");
String password1 = request.getParameter("password1");
String password=request.getParameter("password");
String password2=request.getParameter("password2");
	
	MemberService m=new MemberService();
	

		String oldpassword=m.getInfo(id).getPassword();
		if(password.equals(oldpassword)&&password1.equals(password2)){
		int r = m.updatePassword(password1,id);
		if(r==1){
		out.print("修改成功！");}
		else{
		out.print("修改失败！");
		response.sendRedirect("../../website/updatePassword.jsp");
		}
	}
	else{
		
		out.print("修改失败！");
		response.sendRedirect("../../website/updatePassword.jsp");
		
	}



%>
</body></html>
